In a database management system (DBMS), an optimizer generates a query plan that is used at execution time to perform the accesses and modifications of a particular query. For any one database table referenced in the query, the optimizer may decide on a specific number of columns to use in the table's index for direct access to the table. The decision may be based on estimated cardinalities for distinct values in the table for each column of the index.
At times, the estimated cardinalities may be inaccurate. As a result, the accesses to the table at execution time may be suboptimal. For example, if too few columns are used, the query plan may lead to excessive scanning. On the other hand, if too many columns are used, the query plan may incur greater processing costs using direct access than may have been incurred using sequential access.